# -*- coding:utf-8 -*-
from tkinter import *
from tkinter.scrolledtext import Scrolledtext


def load() -> None:
    with open(filename.get()) as file:
        contents.delete('1.0', end)
        contents.insert(INSERT, file.read())


def save() -> None:
    with open(filename.get(), 'w') as file:
        file.write(contents.get('1.0', end))


top = Tk()
top.title('Simple Editor')
contents = Scrolledtext()
contents.pack(side=BOTTOM, expand=True, fill=BOTH)
filename = Entry()
filename.pack(side=LEFT, expand=True, fill=X)
Button(text='Open', command=load).pack(side=LEFT)
Button(text='Save', command=save).pack(side=LEFT)
mainloop()
